<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version();
});

//验证码生成和验证
$router->get('captcha', 'CaptchaController@captcha');
$router->get('verify', 'CaptchaController@verify');

//导出excel
$router->get('export', 'TestController@exportExcel');

//发送邮件  
$router->get('sendMail', 'TestController@sendMail');

//生成二维码  
$router->get('qrcode', 'TestController@qrcode');

//队列测试  
$router->get('queue', 'TestController@doQueue');

$router->get('test', 'TestController@test');

//访问速率限制
$router->group(['middleware' => 'throttle:1,1'], function () use ($router) {
    $router->get('ratelimit', 'TestController@ratelimit');
});


//==========v1==========
$router->group(['prefix' => 'v1', 'namespace' => 'v1'], function () use ($router) {
    $router->post('users', 'UserController@store');
    $router->post('login', 'UserController@login');
});

//=========v2==========
$router->group(['prefix' => 'v2', 'namespace' => 'v2'], function () use ($router) {
    $router->post('admins', 'AdminController@store');
    $router->post('login', 'AdminController@login');
});

//nsq 消息服务
$router->get('pub', 'PubController@pubToMq');
